{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "bba9d13a",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd \n",
    "import matplotlib.pylab as plt\n",
    "df = pd.read_csv(\"data/ssd_failure_tag.csv\")\n",
    "df_all = pd.read_csv(\"data/20191231.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d3be91b1",
   "metadata": {},
   "outputs": [],
   "source": [
    "grouped = df.groupby('model')\n",
    "res_df = pd.DataFrame(columns=['model','failure','all', 'percentage'])\n",
    "row = 0\n",
    "for col, group in grouped:\n",
    "    res_df.loc[row] = [col,group.shape[0],'','']\n",
    "    row = row + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "640c7b36",
   "metadata": {},
   "outputs": [],
   "source": [
    "grouped2 = df_all.groupby('model')\n",
    "row = 0\n",
    "for col, group in grouped2:\n",
    "    res_df.iloc[row, 2] = group.shape[0]\n",
    "    res_df.iloc[row, 3] = res_df.iloc[row, 1] * 100 / res_df.iloc[row, 2]\n",
    "    row = row + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "5e8b15ac",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='Drive models', ylabel='RFR(%)'>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAEGCAYAAABvtY4XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAATjUlEQVR4nO3de5RlZ13m8e9D5x6IOKZgcqHpcAs45AY1GTXcDBLDBIhLIyRKHBiYXiwlwOhEW1mzEJ1LZs3IIoJLbREQJtyMQVhEcxlCwEu4VCeduyCEgAnRFCBCI5Lbb/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MxoP/82xdb8JvBm4YTjd8ovAC5bZtvOAdwz3BpgHXj6sfy3wniS/AnxoYeOquiLJU4Brhv9ftjGauXF83vfnAOcnuXd4/ueW2TbtwzxNUpI65RCNJHXKgJekThnwktQpA16SOmXAS1KnDHhJ6pQBL0md+v/NSxBqtFB+jwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "res_df.plot(x = 'model', y = 'percentage', kind='bar', rot = 0, xlabel = 'Drive models', ylabel = 'RFR(%)', legend = None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "3d706f72",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_topo = pd.read_csv (\"data/location_info_of_ssd.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "7c8e1b55",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "        app  rack_id  node_id model  disk_id  slot_id\n",
      "0       WPS  28568.0        4    A1        0      2.0\n",
      "1       WPS  28568.0        4    A1        1     16.0\n",
      "2       WPS  28568.0        4    A1        2     13.0\n",
      "3       WSM  25609.0        6    A1        3      6.0\n",
      "4       WSM  25609.0        6    A1        4     19.0\n",
      "...     ...      ...      ...   ...      ...      ...\n",
      "965490   RM  28573.0   238732    B2    49253      NaN\n",
      "965491   RM  28573.0   238732    B2    49254      NaN\n",
      "965492   RM  28573.0   238732    B2    49255      NaN\n",
      "965493   RM  28573.0   238732    B2    49256      NaN\n",
      "965494   RM  28573.0   238732    B2    49257      NaN\n",
      "\n",
      "[965495 rows x 6 columns]\n"
     ]
    }
   ],
   "source": [
    "print(df_topo)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "0c43b65f",
   "metadata": {},
   "outputs": [],
   "source": [
    "grouped = df_topo.groupby('node_id')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "5816f386",
   "metadata": {},
   "outputs": [],
   "source": [
    "check_node = pd.DataFrame(columns=['node_id','res'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "50fc79c4",
   "metadata": {},
   "outputs": [],
   "source": [
    "sum = 0\n",
    "cnt = 0\n",
    "for col, group in grouped:\n",
    "    cnt = cnt + 1\n",
    "    grouped2 = group.groupby('model')\n",
    "    max = 0\n",
    "    for col2, group2 in grouped2:\n",
    "        if group2.shape[0] > max:\n",
    "            max = group2.shape[0]\n",
    "    sum = sum + max * 100 / group.shape[0]\n",
    "    # print(sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "9087e897",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "96.90931329987225\n"
     ]
    }
   ],
   "source": [
    "print(sum / cnt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "3aa4862e",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_topo['rack_id'] = df_topo['rack_id'].astype('int')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "7351070e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "        app  rack_id  node_id model  disk_id  slot_id\n",
      "0       WPS    28568        4    A1        0      2.0\n",
      "1       WPS    28568        4    A1        1     16.0\n",
      "2       WPS    28568        4    A1        2     13.0\n",
      "3       WSM    25609        6    A1        3      6.0\n",
      "4       WSM    25609        6    A1        4     19.0\n",
      "...     ...      ...      ...   ...      ...      ...\n",
      "965490   RM    28573   238732    B2    49253      NaN\n",
      "965491   RM    28573   238732    B2    49254      NaN\n",
      "965492   RM    28573   238732    B2    49255      NaN\n",
      "965493   RM    28573   238732    B2    49256      NaN\n",
      "965494   RM    28573   238732    B2    49257      NaN\n",
      "\n",
      "[965495 rows x 6 columns]\n"
     ]
    }
   ],
   "source": [
    "print(df_topo)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a09d59f9",
   "metadata": {},
   "outputs": [],
   "source": [
    "grouped = df_topo.groupby('rack_id')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "6266ff2e",
   "metadata": {},
   "outputs": [],
   "source": [
    "check_rack = pd.DataFrame(columns=['rack_id','res'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "2362aef3",
   "metadata": {},
   "outputs": [],
   "source": [
    "sum = 0\n",
    "cnt = 0\n",
    "for col, group in grouped:\n",
    "    cnt = cnt + 1\n",
    "    grouped2 = group.groupby('model')\n",
    "    max = 0\n",
    "    for col2, group2 in grouped2:\n",
    "        if group2.shape[0] > max:\n",
    "            max = group2.shape[0]\n",
    "    sum = sum + max * 100 / group.shape[0]\n",
    "    # print(sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "a50d88d0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "92.58484983511957\n"
     ]
    }
   ],
   "source": [
    "print(sum / cnt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "fe4704a7",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_avg_num_of_ssds(df, col, sub_col):\n",
    "    # col is model or app; sub_col is node_id or rack_id\n",
    "    df_mean = pd.DataFrame()\n",
    "    if col == 'app':\n",
    "        apps = ['WSM', 'RM', 'WPS', 'DB', 'SS', 'DAE', 'NAS', 'WS']\n",
    "        df = df[df['app'].isin(apps)]\n",
    "\n",
    "    df_mean = df.groupby([col, sub_col])['disk_id'].count().reset_index().groupby([\n",
    "        col])['disk_id'].mean().reset_index().rename(columns={'disk_id': 'mean'})\n",
    "    # print(df_mean)\n",
    "    df_std = df.groupby([col, sub_col])['disk_id'].count().reset_index().groupby([\n",
    "        col])['disk_id'].std().reset_index().rename(columns={'disk_id': 'std'})\n",
    "    df_n = df.groupby([col, sub_col])['disk_id'].count().reset_index().groupby([\n",
    "        col])['disk_id'].count().reset_index().rename(columns={'disk_id': 'n'})\n",
    "    \n",
    "    df_mean = df_mean.merge(df_std, on=[col])\n",
    "    df_mean = df_mean.merge(df_n, on=[col])\n",
    "    # compute 95% confidence interval\n",
    "    df_mean['conf'] = 1.96 * df_mean['std'] / np.sqrt(df_mean['n'])\n",
    "    df_mean[[col, 'mean', 'conf']].to_csv(\"results/avg_num_\" + col + \"_\" + sub_col[0:4] + \".csv\", index=False)\n",
    "    # df_mean.plot(x = 'model', y = 'mean', kind='bar', rot = 0, xlabel = 'Drive models', ylabel = 'Average number of SSDs', legend = None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "83bd9499",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "get_avg_num_of_ssds(df_topo, 'model', 'node_id')\n",
    "get_avg_num_of_ssds(df_topo, 'model', 'rack_id')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "509a4c71",
   "metadata": {},
   "outputs": [],
   "source": [
    "node = pd.read_csv (\"results/avg_num_model_node.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "739e5613",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='Drive models', ylabel='Average number of SSDs'>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEGCAYAAABiq/5QAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAXcUlEQVR4nO3de5RlZXnn8e9PEAEVwbFRbk2jQU3iBbVDHG8oeCE2F8chKhFGLmPHFUXMMkp7QZJlMpKJusBhRm0FReINiSIRI40gjcmgsRsaocErkgREaS8MN5XbM3+cXVA2Vad3V519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klgCSPZTDPy8QsjrdNtV5VXZ/BnPpPAV7J4OwdBndC+q9VtamJv34zafmeSc/vod3/q6m+XAvwnqr68LRvqrq4+StgGfDxJO+vqk+0iCfdyzN+LRjNDJkfYjA5XJtRC58F3go8oqq+3bSdBxwzMfd7kqfNIqX/y313CXs1g0m+AP5lo/YJ5wFHZXCnL5Ls0nxhfa8kuwM/raqPMOhWevos8lNPecav+W7iTk0PZnD3rTOA97d871kM+tvfPant3cBJwLebYaE/Ag6YYW7HAB9r7s2wATiyaT8W+FSS44AvTqxcVauS/C5wSfN751YGs2BOnnf/+cBbktzZvP7fZpibeszhnJLUM3b1SFLPWPglqWcs/JLUMxZ+SeoZC78k9YyFX5J6xsIvST3z/wGgmmODaXro8AAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "node.plot(x = 'model', y = 'mean', kind='bar', rot = 0, xlabel = 'Drive models', ylabel = 'Average number of SSDs', legend = None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "cb9f228e",
   "metadata": {},
   "outputs": [],
   "source": [
    "rack = pd.read_csv (\"results/avg_num_model_rack.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "d18a02b0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='Drive models', ylabel='Average number of SSDs'>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEGCAYAAABiq/5QAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAXGUlEQVR4nO3de5hlVXnn8e9PEEERQW2QeyOix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fnPGgqi/2/wpYCXw0ybur6mMD4kl3ssevTUa/QuYH6BaHGzJr4WTgjcADqurSvu0s4LVTa78n2WcjUvpf3HWXsJfQLfIF8K/rtE85C3hFujt9kWTn/gvrOyXZHfhBVX2IbljpcRuRn0bKHr+Wuqk7Nd2b7u5bHwfePfDYU+nG298+re3twHHApf200O8Az55nbq8FPtLfm2EtcHjffhTwySRHA6dPPbmqzk7yK8CX+787N9OthDl93f2nAW9I8vP+8f8yz9w0Yk7nlKSRcahHkkbGwi9JI2Phl6SRsfBL0shY+CVpZCz8kjQyFn5JGpn/DxDMOivg4j5pAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "rack.plot(x = 'model', y = 'mean', kind='bar', rot = 0, xlabel = 'Drive models', ylabel = 'Average number of SSDs', legend = None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "30b4719d",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.DataFrame(columns=['model','RFR','node','rack'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "cb95ae5d",
   "metadata": {},
   "outputs": [],
   "source": [
    "df['model'] = node['model']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "aca187c5",
   "metadata": {},
   "outputs": [],
   "source": [
    "df['RFR'] = res_df['percentage'].astype('float')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "0390fd29",
   "metadata": {},
   "outputs": [],
   "source": [
    "df['node'] = node['mean']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "2ec3dcf8",
   "metadata": {},
   "outputs": [],
   "source": [
    "df['rack'] = rack['mean']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "09cb6657",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   model       RFR       node       rack\n",
      "0     A1  0.374522   4.720236  36.028426\n",
      "1     A2  1.610844   2.736831  32.390458\n",
      "2     A3  8.167402  11.879103  41.880424\n",
      "3     A4  1.290521   1.012766  11.467555\n",
      "4     A5  0.933137   2.893206  18.253165\n",
      "5     A6  1.762321  11.988191  36.914286\n",
      "6     B1  0.435627   4.464976  34.969676\n",
      "7     B2  1.390328   2.829456  22.278607\n",
      "8     B3  4.685717   6.218261  22.281062\n",
      "9     C1  6.260461   8.005717  43.008376\n",
      "10    C2  5.719053   1.043393   3.072257\n"
     ]
    }
   ],
   "source": [
    "print(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "4aa453d1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>RFR</th>\n",
       "      <th>node</th>\n",
       "      <th>rack</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>RFR</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.354545</td>\n",
       "      <td>0.281818</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>node</th>\n",
       "      <td>0.354545</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.845455</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rack</th>\n",
       "      <td>0.281818</td>\n",
       "      <td>0.845455</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           RFR      node      rack\n",
       "RFR   1.000000  0.354545  0.281818\n",
       "node  0.354545  1.000000  0.845455\n",
       "rack  0.281818  0.845455  1.000000"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.corr(method='spearman')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f6eec610",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
